﻿@{
    Layout = "~/Areas/Web/Views/Shared/_UserCenter.cshtml";
    ViewBag.Title = "个人中心";
}
@using Himall.Core;
@model Himall.Model.UserCenterModel
<link href="~/Areas/Web/Content/home.css" rel="stylesheet" />
<div class="box1">
    <div class="home-box cl">

        <div class="user-info">
            @if (String.IsNullOrEmpty(ViewBag.Logo))
            {
                <img src="/Areas/Web/images/avatar.png" />
            }
            else
            {
                 <img src="@ViewBag.Logo" />
            }
            <p class="user-name">@ViewBag.UserName<span>(@Model.GradeName)</span></p>
            @if (Model.memberAccountSafety.AccountSafetyLevel == 1)
            {
                <p class="user-secu"><a href="AccountSafety">账户安全：<progress value="33" max="100"></progress><span>低</span></a></p>
            }
            else if (Model.memberAccountSafety.AccountSafetyLevel == 4)
            {
               <p class="user-secu"> <a href="AccountSafety">账户安全：<progress value="100" max="100"></progress><span>高</span></a></p>
            }
            else
            {
                <p class="user-secu"><a href="AccountSafety">账户安全：<progress value="66" max="100"></progress><span>中</span></a></p>
            }
            <p class="test-icon">
                @foreach (var messagePlugin in @ViewBag.BindContactInfo)
                {
                    var info = messagePlugin.PluginId.IndexOf("SMS") > 0 ? "mobile" : "email";
                    if (messagePlugin.IsBind)
                    {
                        <a href="/UserInfo" title="@{@messagePlugin.ShortName}已验证"><i class="ident-@info active"></i></a>

                    }
                    else if (@messagePlugin.IsSettingsValid)
                    {
                        <a href="/UserCenter/Bind?pluginId=@(messagePlugin.PluginId)" title="@{@messagePlugin.ShortName}验证"><i class="ident-@info"></i></a>
                    }
                }

            </p>

        </div>
        <ul class="user-manage">
            <li><a href="@Url.Action("index", "UserOrder" , new { orderstatus=(int)Himall.Model.OrderInfo.OrderOperateStatus.WaitPay })"><i class="icon1"></i><p>待付款<span>@Model.WaitPayOrders</span></p></a></li>
            <li><a href="@Url.Action("index", "UserOrder" , new { orderstatus=(int)Himall.Model.OrderInfo.OrderOperateStatus.WaitReceiving })"><i class="icon2"></i><p>待收货<span>@Model.WaitReceivingOrders</span></p></a></li>
            <li><a href="@Url.Action("satisfied", "OrderEvaluation" )"><i class="icon3"></i><p>待评价<span>@Model.WaitEvaluationOrders</span></p></a></li>
            <li><a href="@Url.Action("List", "orderrefund")"><i class="icon4"></i><p>售后中<span>@Model.RefundCount</span></p></a></li>
        </ul>
        <ul class="user-manage manage-2">
            <li><a href="@Url.Action("index", "userintegral")"><i class="icon5"></i><p>积分<span>@(Model.Intergral)分</span></p></a></li>
            <li><a href="@Url.Action("index", "usercoupon")"><i class="icon6"></i><p>优惠券<span>@(Model.UserCoupon)张</span></p></a></li>
            <li><a href="@Url.Action("Index", "usercapital")"><i class="icon7"></i><p>余额<span>@(ViewBag.Balance)元</span></p></a></li>
        </ul>
    </div>

    <div class="list-mod cl">
        @{var showFollwProducts = Model.FollwProducts.Count > 0 ? "" : "empty-show";}
        <div class="home-box ms-myfav @showFollwProducts">
            <h3><a href="/productConcern/">收藏的商品</a><a href="/productConcern/index" class="more">更多 ></a></h3>
            <ul>
                @foreach (var p in Model.FollwProducts)
                {
                    <li>
                        <a href="@Url.Action("detail", "Product" , new { id=@p.ProductId})" title="@p.ProductName" target="_blank">
                            <img width="90" height="90" src="@p.ImagePath/1_100.png" />
                            <i>去购买 ></i>
                        </a>
                        <p><a>@p.ProductName</a></p>
                    </li>
                }
            </ul>
        </div>
        @{var showFollowShops = Model.FollowShopsCount > 0 ? "" : "empty-show";}
        <div class="home-box ms-myfavShop @showFollowShops">
            <h3><a href="/shopConcern">收藏的店铺</a><a href="/shopConcern/Index" class="more">更多 ></a></h3>
            <ul>
                @foreach (var shop in Model.FollowShops)
                {
                    <li>
                        <a href="@Url.Action("home", "shop" , new { id=@shop.ShopID})" target="_blank">
                            <img width="90" height="90" src="@shop.Logo" />
                            <i>前往 ></i>
                        </a>
                        <p><a href="@Url.Action("home", "shop" , new { id=@shop.ShopID})" target="_blank">@shop.ShopName</a></p>
                    </li>

                }
            </ul>
        </div>

        @{var showUnEvaluatProducts = @Model.FollowShopCartsCount > 0 ? "" : "empty-show";}
        <div class="home-box ms-mycomment @showUnEvaluatProducts">
            <h3><a target="_blank" href="@Url.Action("cart", "Cart" )">购物车</a><a href="@Url.Action("cart", "Cart" )" target="_blank" class="more">查看购物车 ></a></h3>
            <ul>
                @foreach (var p in @Model.FollowShopCarts)
                {
                    <li>
                        <a title="@p.ProductName" href="@Url.Action("cart", "Cart" )" target="_blank">
                            <img width="90" height="90" src="@p.ImagePath/1_100.png" />
                            <i></i>
                        </a>
                        <p><a href="@Url.Action("detail", "Product" , new { id=@p.ProductId })" target="_blank"><span>@p.ProductName</span></a></p>
                    </li>
                }
            </ul>
        </div>

        @{var showBrowsingProducts = ViewBag.BrowsingProducts.Count > 0 ? "" : "empty-show";}
        <div class="home-box ms-myhistory @showBrowsingProducts">
            <h3><a href="#">浏览记录</a></h3>
            <ul>
                @foreach (var p in ViewBag.BrowsingProducts)
                {
                    <li>
                        <a href="@Url.Action("detail", "Product" , new { id=@p.ProductId })" title="@p.ProductName" target="_blank">
                            <img width="90" height="90" src="@p.ImagePath/1_100.png" />
                            <i>去购买 ></i>
                        </a>
                        <p><a href="@Url.Action("detail", "Product" , new { id=@p.ProductId })" target="_blank"><span>@p.ProductName</span></a></p>
                    </li>
                }
            </ul>
        </div>

        <div class="home-box ms-recommend">
            <h3><a href="#">商品推荐</a></h3>
            <ul>
                @if (ViewBag.Top3RecommendProducts != null)
                {
                    foreach (var p in ViewBag.Top3RecommendProducts)
                    {
                        <li>
                            <a title="@p.ProductName" href="@Url.Action("detail", "Product" , new { id=@p.Id})" target="_blank">
                                <img width="90" height="90" src="@p.ImagePath/1_100.png" />
                                <i>去购买 ></i>
                            </a>
                            <p><a href="@Url.Action("detail", "Product" , new { id=@p.Id})" target="_blank"><span>@p.ProductName</span></a></p>
                        </li>
                    }
                }

            </ul>
        </div>
    </div>
</div>
